using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class incentive_ruleMap : EntityTypeConfiguration<incentive_rule>
    {
        public incentive_ruleMap()
        {
            // Primary Key
            this.HasKey(t => t.incentive_rule_id);

            // Properties
            // Table & Column Mappings
            this.ToTable("incentive_rule");
            this.Property(t => t.incentive_rule_id).HasColumnName("incentive_rule_id");
            this.Property(t => t.rule_type_id).HasColumnName("rule_type_id");
            this.Property(t => t.item_incentive).HasColumnName("item_incentive");
            this.Property(t => t.role_id).HasColumnName("role_id");

            // Relationships
            this.HasOptional(t => t.role)
                .WithMany(t => t.incentive_rule)
                .HasForeignKey(d => d.role_id);

        }
    }
}
